import unittest
import os

# case_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# suite_plane = unittest.TestLoader().discover(case_dir,'planeTicket.py')
# unittest.TextTestRunner(verbosity=2).run(suite_plane)
# case_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# suite_plane = unittest.TestLoader().discover(case_dir,'intFlightTicket.py')
# unittest.TextTestRunner(verbosity=2).run(suite_plane)
# suite_hotel = unittest.TestLoader().discover(case_dir,'hotel.py')
# unittest.TextTestRunner(verbosity=2).run(suite_hotel)
#
# suite_train = unittest.TestLoader().discover(case_dir,'trainTickets.py')
# unittest.TextTestRunner(verbosity=2).run(suite_train)559*

# 获取项目根目录
project_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
test_dir = project_root  # 或者指定特定的测试目录

# 发现并运行所有测试用例
if __name__ == '__main__':
    # 按文件名发现测试
    suite = unittest.TestSuite()

    # 添加特定的测试文件
    suite.addTests(unittest.TestLoader().discover(test_dir, 'planeTicket.py'))
    # suite.addTests(unittest.TestLoader().discover(test_dir, 'intFlightTicket1.py'))

    # 运行测试
    runner = unittest.TextTestRunner(verbosity=2)
    runner.run(suite)
